package com.elem.test;

public class ClassDemo01 {
    public static void main(String[] args) throws ClassNotFoundException {
        // 获取Class的三种方式
        // 1. 通过Class类的属性class
        Class accountClass1 = Account.class;
        System.out.println("accountClass1 = " + accountClass1);
        // 2. 通过对象实例的getClass()方法
        Account account = new Account();
        Class accountClass2 = account.getClass();
        System.out.println("accountClass2 = " + accountClass2);
        // 3. 通过Class类的静态方法forName()
        Class accountClass3 = Class.forName("com.neuedu.elem.test.Account");
        System.out.println("accountClass3 = " + accountClass3);

        System.out.println(accountClass1 == accountClass2);    // true);
        System.out.println(accountClass1 == accountClass3);    // true);


    }
}
